﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
</head>
<body>
</body>
</html>
<script>
    var c = function () {
        this.name = "aa";

        this.say = function (name) {
            var that = this;

            console.log(name);
            var arg = arguments;
            arguments.callee.apply(that, arg);
        }
    }
    var c1 = new c();

    //c1.say("abc");

    var p = function (name, age) {
        this.name = name;

        this.getName = function () {
            return "Name是:" + this.name;
        }
    }

    p.prototype.setName = function (val) {
        this.name = val;
    }
    p.prototype.number = 12;

    for (var i in p.prototype) {
        console.log("p的原型上面的属性和方法共有:" + i + "--" + p.prototype[i]);
    }

    var c = function (age, name) {
        this.age = age;

        p.apply(this, [name]);
        console.log(p.length);

        this.getAge = function () {
            return this.age;
        }
    }

    c.prototype = p.prototype;

    var c1 = new c("13", "张三");
    console.log(c1.getName());
    c1.setName("李四");
    console.log(c1.getName());
    console.log(c1.getAge());


    var a = 2;
    function f()
    {
        alert(window.a);
        var a = 13;
    }
    f();
</script>
